package com.moefor.clover.model;

import java.util.Date;

import javax.persistence.*;

import com.moefor.clover.model.enums.StateOfComment;

@Entity
public class Comment extends BaseEntity{
	@JoinColumn(nullable = false)
	@ManyToOne(cascade = {CascadeType.ALL})
	private User author;
	
	@JoinColumn(nullable = false)
	@ManyToOne(cascade = {CascadeType.ALL})
	private Goods goods;
	
	@Column(nullable = false)
	private String content;
	
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@JoinColumn(nullable = true)
	@ManyToOne(cascade = {CascadeType.ALL})
	private User reply;
	
	@JoinColumn(nullable = true)
	private Date date;
	
	public User getReply() {
		return reply;
	}

	public void setReply(User reply) {
		this.reply = reply;
	}

	@Column(nullable = false)
	@Enumerated(EnumType.ORDINAL)
	private StateOfComment state;

	public User getAuthor() {
		return author;
	}

	public void setAuthor(User author) {
		this.author = author;
	}

	public Goods getGoods() {
		return goods;
	}

	public void setGoods(Goods goods) {
		this.goods = goods;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public StateOfComment getState() {
		return state;
	}

	public void setState(StateOfComment state) {
		this.state = state;
	}
}
